<template>
  <el-container style="height: 500px; border: 1px solid #eee">
    <el-aside width="200px" style="background-color: rgb(238, 241, 246)">
      <el-menu>
        <el-menu-item-group title="菜单列表">
          <el-menu-item @click="handleClick('学生管理')" index="1">学生管理</el-menu-item>
          <el-menu-item @click="handleClick('班级管理')" index="2">班级管理</el-menu-item>
          <el-menu-item @click="handleClick('学院管理')" index="3">学院管理</el-menu-item>
          <el-menu-item @click="handleClick('宿舍管理')" index="4">宿舍管理</el-menu-item>
        </el-menu-item-group>
      </el-menu>
    </el-aside>

    <el-container>
      <el-header style="text-align: right; font-size: 12px">
      </el-header>

      <el-main>
        <el-tag v-for="(tag,index) in taglist" :key="index" closable @close="handleClose(tag)">
          {{ tag }}
        </el-tag>
        
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>
<style>
.el-tag{
    margin-left: 5px;
}
.el-header {
  background-color: #b3c0d1;
  color: #333;
  line-height: 60px;
}

.el-aside {
  color: #333;
}
.el-main{
    padding: 0;
}
</style>

<script>
import {mapState} from 'vuex'
export default {
  data() {
    return {
      
    }
  },
  computed:{
    ...mapState(['taglist'])
  },
  methods:{
    handleClick(item){
      this.$store.commit('addTag',item)
    },
    handleClose(item){
      this.$store.commit('closeTag',item)
    }
  }
}
</script>